<?php
/**
 * Created By PhpStorm
 * Author: patrick wu
 * Date: 2020/9/29
 * Time: 16:19
 */
namespace App\Http\Model\Mysql;

use Illuminate\Database\Eloquent\Model;

class OrderProductModel extends Model
{
    protected $table    =   'mini_order_product';

    protected $guarded  =   [];

    protected $dateFormat   =   'U';

    /**
     * 定义连接规格表
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function spec()
    {
        return $this->hasOne(ProductSpecsModel::class, 'id', 'item_id');
    }

    /**
     * 定义连接商品表
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function good()
    {
        return $this->hasOne(ProductModel::class, 'id', 'product_id');
    }
}
